package org.idea.qiyu.framework.retry.jdk.config;

import org.idea.qiyu.framework.retry.jdk.core.FastRetryStrategy;
import org.idea.qiyu.framework.retry.jdk.core.listener.DefaultRetryListener;
import org.idea.qiyu.framework.retry.jdk.core.listener.RetryListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.concurrent.*;

/**
 * @Author linhao
 * @Date created in 9:21 上午 2021/10/3
 */
@Configuration
public class RetryConfig {

    @Bean
    public FastRetryStrategy fastRetryStrategy(){
        return new FastRetryStrategy();
    }

    @Bean
    public RetryListener defaultRetryListener(){
        return new DefaultRetryListener();
    }

    @Bean
    public ExecutorService retryThreadPool(){
        ExecutorService executorService = new ThreadPoolExecutor(2,4,0L, TimeUnit.SECONDS,new LinkedBlockingQueue<>());
        return executorService;
    }

    public static void main(String[] args) {
        System.out.println("");
        ArrayList arrayList = new ArrayList(2);
    }
}
